package com.wodsy.phoenix.dataobject.goodsc.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * TbGoodsInventory entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tb_goods_inventory", catalog = "goodsc")
public class GoodsInventory implements java.io.Serializable {

	// Fields
	private static final long serialVersionUID = 1L;
	
	private Integer id;
	private Integer stock;		//库存量
	private Date addTime;			//库存添加时间
	private Date updateTime;		//库存最后修改时间
	
	private GoodsSku goodsSku;
	

	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "sku_id")
	public GoodsSku getGoodsSku() {
		return goodsSku;
	}

	public void setGoodsSku(GoodsSku goodsSku) {
		this.goodsSku = goodsSku;
	}

	// Constructors
	
	/** default constructor */
	public GoodsInventory() {
	}

	/** minimal constructor */
	public GoodsInventory(Integer stock, Date addTime) {
		this.stock = stock;
		this.addTime = addTime;
	}

	/** full constructor */
	public GoodsInventory(Integer stock, Date addTime,
			Date updateTime) {
		this.stock = stock;
		this.addTime = addTime;
		this.updateTime = updateTime;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "stock", nullable = false)
	public Integer getStock() {
		return this.stock;
	}

	public void setStock(Integer stock) {
		this.stock = stock;
	}

	@Column(name = "add_time", nullable = false, length = 19)
	public Date getAddTime() {
		return this.addTime;
	}

	public void setAddTime(Date addTime) {
		this.addTime = addTime;
	}

	@Column(name = "update_time", length = 19)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

}